#ifndef CONFIG_PW_PBL_ALLOCATOR_HPP
#define CONFIG_PW_PBL_ALLOCATOR_HPP

#include "../ValueType.hpp"
#include <algorithm>

namespace pw_pbl::config
{
	/// 分配器
	/// @tparam ...T 分配器参数
	template <typename... T>
	struct Allocator;

	/// 空参数分配器特化实现，使用 operator new 和 operator delete 分配
	template <>
	struct Allocator<>
	{
		inline void *allocate(size_t size, size_t align) noexcept { return operator new(size, std::align_val_t(align)); }
		inline void deallocate(void *p) noexcept { operator delete(p); }
		inline void *realloc(void *p, size_t size, size_t align) noexcept { return deallocate(p), allocate(size, align); }
	};

} // namespace pw_pbl::config

#endif // CONFIG_PW_PBL_ALLOCATOR_HPP
